<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../plugins/mui/mui.min.css" rel="stylesheet" />
		<script src="../../js/statistics.js"></script>
		<script src="../../js/fontset.js"></script>
		<link rel="stylesheet"  href="../../css/life_housekeeper/vegetable_index.css"/>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav header" >
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title"></h1>
		</header>
		<div class="mui-content content-detail" id="content">
			
		</div>
		<script src="../../plugins/mui/mui.min.js"></script>
		<script src="../../plugins/jquery/jquery-3.1.0.min.js"></script>
		<script src="../../js/getApiToken.js"></script>
		<script src="../../js/md5.js" ></script>
		<script src="../../js/life_housekeeper/windowTitleView.js"></script>
		<script src="../../plugins/template/template.js"></script>
		<script type="text/html" id="queryInfo">
			<div class="guide-box">
				<div class=" guide">
					{{each data as item i}}
						<div class="guide-item "><a href="javascript:void(0);">{{i}}</a></div>
					{{/each}}
				</div>	
			</div>
			
			<div class="detail-box">
				{{each data as item i}}
				<ul class="mui-table-view hide">
					{{each item as detail j}}
			        <li class="mui-table-view-cell">
			            <div class="cell-item">
			            	<span>{{detail.goods_name}}</span>
			            	{{if detail.price}}
			            	<div class="item-box">
			            		<span>
			            			<span class="txt-green">
			            				<span>{{detail.price}}</span> 
			            				{{if detail.unit}}
			            				<span>元</span>
			            				{{/if}}
			            			</span>
			            			{{if detail.unit}}
			            			<span class="txt-line">/</span>
			            			{{/if}}
			            		</span>
			                	<span class="txt-unit">{{detail.unit}}</span>
			            	</div>
			            	{{/if}}
			            </div>
			            {{if detail.style || detail.get_time}}
			            <div class="cell-item txt-sm">
			            	{{if detail.style}}
			            	<div class="item-box">
			            		<span>规格：</span>
			            		<span>{{detail.style}}</span>
			            	</div>
			            	{{/if}}
			            	{{if detail.get_time}}
			            	<div class="item-box">
			            		<span>采价期：</span>
			            		<span>{{detail.get_time}}</span>
			            	</div>
			            	{{/if}}
			            </div>
			            {{/if}}
			            {{if detail.remark}}
			            <div class="cell-item txt-sm">
			            	<div class="item-box">
			            		<span>备注：</span>
			            		<span>{{detail.remark}}</span>
			            	</div>
			            </div> 
			            {{/if}}
			        </li>
			        {{/each}}
				</ul>
				{{/each}}
			</div>
			
		</script>
		<script>
			mui.init();
			mui.plusReady(function(){
				var self =plus.webview.currentWebview(),
					title = self.title,
				   dataId = self.dataId;
				   document.title = title;
				   $('.mui-title').html(title);
				if(!dataId){
					return;
				}
				var data ={
					'id': dataId
				};
				console.log(dataId);
				myAjax('/home/vegetable/marketmanage','get',data,function(e){
					var data = JSON.parse(e);
					if(data.code == 1){
						var queryInfo = template('queryInfo',data);
						document.getElementById("content").innerHTML = queryInfo;
						$('.guide .guide-item').eq(0).addClass('active');
						$('.detail-box .mui-table-view').eq(0).removeClass('hide');
						$(".guide").on('tap','.guide-item',function(){
							var $this = $(this);
							$this.addClass('active').siblings('.guide-item').removeClass('active');
							var index = $(this).index();
							$('.detail-box .mui-table-view').eq(index).removeClass('hide').siblings().addClass('hide');
						})
					}
				})
			})
		</script>
	</body>
</html>
